import jwt from "jsonwebtoken";
import type { EventHandlerRequest, H3Event } from "h3";
// 封装: 包外 过程
const useDeTokenSetCookie = (email: string, event: H3Event<EventHandlerRequest>) => {
  const token = jwt.sign({ email }, "secret", {
    expiresIn: "1d",
  });
  setCookie(event, "Authorization", token, {
    maxAge: 60 * 60 * 24, // 一天
  });
}
export default useDeTokenSetCookie
